package com.pshare.framework.listener;

import org.apache.commons.fileupload.ProgressListener;

import com.pshare.constant.SeaxConstants;
import com.pshare.framework.bean.FileUploadProgress;
import com.pshare.tool.SessionTool;

public class FileUploadListener implements ProgressListener {

	public FileUploadListener() {
		
	}
	
	public FileUploadListener(Integer code) {
		this.code = code;
	}
	
	private Integer code;

	@Override
	public void update(long uploadSize, long totalSize, int pItems) {
		FileUploadProgress fileUploadProgress = new FileUploadProgress();
		fileUploadProgress.setTotalSize(totalSize);
		fileUploadProgress.setUploadSize(uploadSize);
		SessionTool.setAttribute(SeaxConstants.KEY_FIELUPLOAD_PROCESS + ":" + code, fileUploadProgress);
	}

}
